/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * JDialogSignalFrequency.java
 *
 * Created on 08/05/2010, 19:39:18
 */
package systole.view.crud.signalFrequency;

import java.awt.Font;
import javax.swing.JFormattedTextField;
import javax.swing.JTextField;
import org.jdesktop.application.Action;

/**
 *
 * @author jmj
 */
public class JDialogSignalFrequency extends javax.swing.JDialog {

    /**
	 * 
	 */
	private static final long serialVersionUID = 4310974357301117178L;
	private ControllerSignalFrequencyEdition controllerSignalFrequencyEdition;

    /** Creates new form JDialogSignalFrequency
     * @param parent
     * @param controllerSignalFrequencyEdition
     */
    public JDialogSignalFrequency(java.awt.Frame parent, ControllerSignalFrequencyEdition controllerSignalFrequencyEdition) {
        super(parent, true);
        initComponents();
        this.controllerSignalFrequencyEdition = controllerSignalFrequencyEdition;
        this.jLblDescription.setFont(this.jLblDescription.getFont().deriveFont(Font.BOLD));
        this.jLblFrequency.setFont(this.jLblFrequency.getFont().deriveFont(Font.BOLD));
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPnlCenter = new javax.swing.JPanel();
        jEdtDescription = new javax.swing.JTextField();
        jEdtFrequency = new javax.swing.JFormattedTextField();
        jLblDescription = new javax.swing.JLabel();
        jLblFrequency = new javax.swing.JLabel();
        jPnlBottom = new javax.swing.JPanel();
        jBtnOk = new javax.swing.JButton();
        jBtnCancel = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setName("Form"); // NOI18N
        setResizable(false);

        jPnlCenter.setName("jPnlCenter"); // NOI18N

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(systole.view.SystoleApp.class).getContext().getResourceMap(JDialogSignalFrequency.class);
        jEdtDescription.setText(resourceMap.getString("jEdtDescription.text")); // NOI18N
        jEdtDescription.setToolTipText(resourceMap.getString("jEdtDescription.toolTipText")); // NOI18N
        jEdtDescription.setName("jEdtDescription"); // NOI18N

        jEdtFrequency.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter()));
        jEdtFrequency.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        jEdtFrequency.setToolTipText(resourceMap.getString("jEdtFrequency.toolTipText")); // NOI18N
        jEdtFrequency.setName("jEdtFrequency"); // NOI18N

        jLblDescription.setFont(jLblDescription.getFont().deriveFont(jLblDescription.getFont().getStyle() | java.awt.Font.BOLD));
        jLblDescription.setText(resourceMap.getString("jLblDescription.text")); // NOI18N
        jLblDescription.setName("jLblDescription"); // NOI18N

        jLblFrequency.setFont(jLblFrequency.getFont().deriveFont(jLblFrequency.getFont().getStyle() | java.awt.Font.BOLD));
        jLblFrequency.setText(resourceMap.getString("jLblFrequency.text")); // NOI18N
        jLblFrequency.setName("jLblFrequency"); // NOI18N

        javax.swing.GroupLayout jPnlCenterLayout = new javax.swing.GroupLayout(jPnlCenter);
        jPnlCenter.setLayout(jPnlCenterLayout);
        jPnlCenterLayout.setHorizontalGroup(
            jPnlCenterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPnlCenterLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPnlCenterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLblDescription, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLblFrequency, javax.swing.GroupLayout.Alignment.TRAILING))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPnlCenterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jEdtFrequency, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jEdtDescription, javax.swing.GroupLayout.PREFERRED_SIZE, 236, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(23, 23, 23))
        );
        jPnlCenterLayout.setVerticalGroup(
            jPnlCenterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPnlCenterLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPnlCenterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLblDescription)
                    .addComponent(jEdtDescription, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPnlCenterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLblFrequency)
                    .addComponent(jEdtFrequency, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        getContentPane().add(jPnlCenter, java.awt.BorderLayout.CENTER);

        jPnlBottom.setName("jPnlBottom"); // NOI18N
        jPnlBottom.setPreferredSize(new java.awt.Dimension(174, 40));

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(systole.view.SystoleApp.class).getContext().getActionMap(JDialogSignalFrequency.class, this);
        jBtnOk.setAction(actionMap.get("confirm")); // NOI18N
        jBtnOk.setText(resourceMap.getString("jBtnOk.text")); // NOI18N
        jBtnOk.setToolTipText(resourceMap.getString("jBtnOk.toolTipText")); // NOI18N
        jBtnOk.setName("jBtnOk"); // NOI18N
        jPnlBottom.add(jBtnOk);

        jBtnCancel.setAction(actionMap.get("cancel")); // NOI18N
        jBtnCancel.setText(resourceMap.getString("jBtnCancel.text")); // NOI18N
        jBtnCancel.setToolTipText(resourceMap.getString("jBtnCancel.toolTipText")); // NOI18N
        jBtnCancel.setName("jBtnCancel"); // NOI18N
        jPnlBottom.add(jBtnCancel);

        getContentPane().add(jPnlBottom, java.awt.BorderLayout.SOUTH);

        pack();
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jBtnCancel;
    private javax.swing.JButton jBtnOk;
    private javax.swing.JTextField jEdtDescription;
    private javax.swing.JFormattedTextField jEdtFrequency;
    private javax.swing.JLabel jLblDescription;
    private javax.swing.JLabel jLblFrequency;
    private javax.swing.JPanel jPnlBottom;
    private javax.swing.JPanel jPnlCenter;
    // End of variables declaration//GEN-END:variables

    /**
     * @return description edit
     */
    public JTextField getjEdtDescription() {
        return jEdtDescription;
    }

    /**
     * @return frequency edit
     */
    public JFormattedTextField getjEdtFrequency() {
        return jEdtFrequency;
    }

    /**
     * Confirm changes
     */
    @Action
    public void confirm() {
        this.controllerSignalFrequencyEdition.ok();
    }

    /**
     * Cancel changes
     */
    @Action
    public void cancel() {
        this.controllerSignalFrequencyEdition.cancel();
    }


}
